define(["jquery", "easy-admin"], function ($, ea) {


    var init = {
        table_elem: '#rtTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'mall.destruction/index',
        delete_url: 'mall.destruction/delete',
    };

    console.log(ea.url(init.index_url),"fdghdfgdfgdfg")
    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                url: ea.url(init.index_url),
                page: true, //开启分页
                limit:15,
                toolbar: [],
                // search:true,
                defaultToolbar:[],
                cols: [[ //表头
                    {type:'checkbox'}
                    ,{field: 'id', title: '序号', sort: true, width:70}
                    ,{field: 'reference', title: '档号', sort: true ,width:150}
                    ,{field: 'name', title: '案卷名称',  sort: true,align: 'left', minWidth:800}
                    ,{field: 'page_number', title: '页次', sort: true,width:80}
                    ,{field: 'start_end_date', title: '起止日期',  sort: true,width:180}
                    ,{field: 'term', title: '保存期限',selectList: {1: '永久', 2: '20年',3:'30年'}, sort: true,width:100}
                    ,{
                        width: 120,
                        title: '操作',
                        templet: ea.table.tool,
                        operat: [
                            [{
                                text: '销毁',
                                url: init.approval_url,
                                method: 'text',
                                title: '确定销毁吗？',
                                // auth: 'delete',
                                class: 'layui-btn layui-btn-xs layui-btn-normal',
                            }],
                            '']
                    }
                ]],
            });
            ea.listen();
            $('.layui-btn').on('click', function(){
                table.reload('currentTableRenderId', {
                    page: {
                        curr: 1
                    }
                    , where: {
                        term:$("#term").val(),
                        status:$("#status").val(),
                        keyword:$("#keywords").val(),
                        relation:$("#relation").val(),
                        duty:$("#duty").val(),
                        status_stype:$("#status_stype").val(),
                        times:$("#test10").val(),
                    }
                }, 'data');
            });
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});